<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./vue.global.js"></script>
</head>
<body>
    <div id="app">
        <!--        父传子1:子组件定义-->
        <my-head title="hello world" :count="count"></my-head>
    </div>
    <script>
        let app = Vue.createApp({
            data(){
                return {
                    count: 10
                }
            },
            mounted(){
                setTimeout(()=>{
                    this.count = 20
                },2000)
            },
        })

        app.component(
            'MyHead',
            {
                //父传子2:子组件定义接收变量
                props:['title','count'],
                template: `
                <header>
                  <!--父传子3:子组件使用变量-->
                  <div>父组件传递过来的：{{title}} . {{count}}</div>
                    <h2>logo</h2>
                    <ul>
                        <li>首页</li>
                        <li>视频</li>
                        <li>音乐</li>
                    </ul>
                </header>
                `,
            })

        let vm = app.mount('#app');
    </script>

</body>
</html>